home *** CD-ROM | disk | FTP | other *** search
/ Delphi Programmer's Power Pack / Delphi Volume 1.iso / s_to_z / vpe_130 / vb / formmain.frm next >
Text File  |  1996-09-15  |  29KB  |  792 lines

  1. VERSION 4.00
  2. Begin VB.Form FormMain 
  3.    Caption         =   "VPE Demo"
  4.    ClientHeight    =   3495
  5.    ClientLeft      =   990
  6.    ClientTop       =   1755
  7.    ClientWidth     =   4860
  8.    Height          =   3900
  9.    Left            =   930
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   3495
  12.    ScaleWidth      =   4860
  13.    Top             =   1410
  14.    Width           =   4980
  15.    Begin VB.CommandButton PageRight 
  16.       Caption         =   ">>"
  17.       Height          =   255
  18.       Left            =   2520
  19.       TabIndex        =   10
  20.       Top             =   840
  21.       Width           =   495
  22.    End
  23.    Begin VB.CommandButton PageLeft 
  24.       Caption         =   "<<"
  25.       Height          =   255
  26.       Left            =   1800
  27.       TabIndex        =   9
  28.       Top             =   840
  29.       Width           =   495
  30.    End
  31.    Begin VB.CommandButton DelReport 
  32.       Caption         =   "Delete Report"
  33.       Height          =   255
  34.       Left            =   120
  35.       TabIndex        =   8
  36.       Top             =   1560
  37.       Width           =   1215
  38.    End
  39.    Begin VB.CommandButton GenReport 
  40.       Caption         =   "Generate Report"
  41.       Height          =   255
  42.       Left            =   120
  43.       TabIndex        =   7
  44.       Top             =   1200
  45.       Width           =   1215
  46.    End
  47.    Begin VB.CommandButton SpeedClose 
  48.       Caption         =   "Close"
  49.       Height          =   375
  50.       Left            =   3720
  51.       TabIndex        =   6
  52.       Top             =   1200
  53.       Width           =   975
  54.    End
  55.    Begin VB.CommandButton PrecisionClose 
  56.       Caption         =   "Close"
  57.       Height          =   375
  58.       Left            =   3720
  59.       TabIndex        =   5
  60.       Top             =   240
  61.       Width           =   975
  62.    End
  63.    Begin VB.TextBox MsgText 
  64.       BackColor       =   &H00C0C0C0&
  65.       Enabled         =   0   'False
  66.       Height          =   615
  67.       Left            =   120
  68.       MultiLine       =   -1  'True
  69.       TabIndex        =   4
  70.       Top             =   2760
  71.       Width           =   4695
  72.    End
  73.    Begin VB.CommandButton Background 
  74.       Caption         =   "Background"
  75.       Height          =   375
  76.       Left            =   120
  77.       TabIndex        =   3
  78.       Top             =   240
  79.       Width           =   1095
  80.    End
  81.    Begin VB.CommandButton Exit 
  82.       Caption         =   "Exit"
  83.       Height          =   495
  84.       Left            =   1800
  85.       TabIndex        =   2
  86.       Top             =   2040
  87.       Width           =   1095
  88.    End
  89.    Begin VB.CommandButton Speed 
  90.       Caption         =   "Speed + Tables"
  91.       Height          =   495
  92.       Left            =   1440
  93.       TabIndex        =   1
  94.       Top             =   1200
  95.       Width           =   1935
  96.    End
  97.    Begin VB.CommandButton Precision 
  98.       Caption         =   "Capabilities + Precision"
  99.       Height          =   495
  100.       Left            =   1440
  101.       TabIndex        =   0
  102.       Top             =   240
  103.       Width           =   1935
  104.    End
  105. End
  106. Attribute VB_Name = "FormMain"
  107. Attribute VB_Creatable = False
  108. Attribute VB_Exposed = False
  109. Rem ordinal for storing a setting
  110. Const HEADLINE = 1
  111.  
  112. Dim hPrecision As Long
  113. Dim hSpeed As Long
  114. Dim rc As Rect
  115.    
  116. Dim sum_amount, sum_prorated, sum_tax As Double
  117.  
  118. Private Sub DelReport_Click()
  119.    If Dir("journal.rpt") = "" Then
  120.       Exit Sub
  121.    End If
  122.    
  123.    Kill "journal.rpt"
  124. End Sub
  125.  
  126. Private Sub Exit_Click()
  127.    Call ClosePrecision
  128.    Call CloseSpeed
  129.    
  130.    If hPrecision = 0 And hSpeed = 0 Then
  131.       End
  132.    End If
  133. End Sub
  134.  
  135. Private Sub Form_Load()
  136.    Call InitVPE
  137.    hPrecision = 0
  138.    hSpeed = 0
  139. End Sub
  140.  
  141.  
  142. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  143.    Call ClosePrecision
  144.    Call CloseSpeed
  145.    
  146.    If hPrecision <> 0 Or hSpeed <> 0 Then
  147.       Cancel = 1
  148.    End If
  149. End Sub
  150.  
  151.  
  152. Private Sub GenReport_Click()
  153.    MsgText = "Generating pseudo report-file..."
  154.    MsgText.Refresh
  155.    Dim i, stepper, min, z As Integer
  156.    Dim count, table As Long
  157.  
  158.    count = 0
  159.    table = 1
  160.    Randomize
  161.    Open "journal.rpt" For Output As 1
  162.    Print #1, "Test-Document"
  163.    Print #1, "1996" + vbCrLf
  164.    z = 0
  165.    
  166.    While count < 20000
  167.       If z < Rnd * 5 + 10 Then
  168.          stepper = 4
  169.          min = 3
  170.       Else
  171.          stepper = 21
  172.          min = 20
  173.          z = -1
  174.       End If
  175.       
  176.       z = z + 1
  177.       Print #1, "@Table " + Str(table)
  178.       table = table + 1
  179.       For i = Rnd * stepper + min To 0 Step -1
  180.          Print #1, count
  181.          Print #1, Format(Rnd * 28 + 1, "##00"); "."; Format(Rnd Mod 12 + 1, "##00"); ".96"
  182.          Print #1, Format(Rnd * 99999, "##,###.00")
  183.          Print #1, Format(Rnd * 99999, "##,###.00")
  184.          Print #1, Format(Rnd * 99999, "##,###.00")
  185.          Print #1, vbCrLf
  186.          count = count + 7
  187.       Next
  188.    Wend
  189.  
  190.    Close #1
  191.    MsgText = "Report generation finished."
  192. End Sub
  193.  
  194. Private Sub Pageleft_Click()
  195.    If hPrecision Then
  196.       Call VpeSetUpdate(hPrecision, True)
  197.       Call VpeGotoPage(hPrecision, VpeGetCurrentPage(hPrecision) - 1)
  198.       Call VpeSetUpdate(hPrecision, False)
  199.    End If
  200. End Sub
  201.  
  202. Private Sub PageRight_Click()
  203.    If hPrecision Then
  204.       Call VpeSetUpdate(hPrecision, True)
  205.       Call VpeGotoPage(hPrecision, VpeGetCurrentPage(hPrecision) + 1)
  206.       Call VpeSetUpdate(hPrecision, False)
  207.    End If
  208. End Sub
  209.  
  210.  
  211. Private Sub Precision_Click()
  212.    If hPrecision Then
  213.       Exit Sub
  214.    End If
  215.    
  216.    MsgText = "This window shows the capabilities of VPE, the Virtual Print Engine"
  217.    MsgText.Refresh
  218.    Call PrecisionProc(0)
  219. End Sub
  220.  
  221.  
  222. Private Sub PrecisionClose_Click()
  223.    Call ClosePrecision
  224. End Sub
  225.  
  226.  
  227.  
  228. Private Sub Page1(ByVal hDoc As Long)
  229.    Dim DemoText As String
  230.    Dim y As Long
  231.  
  232.    DemoText = "The moment of impact bursts through the silence and in a roar of sound, the final second is prolonged in a world of echoes as if concrete and clay of Broadway itself was reliving its memories."
  233.    DemoText = DemoText + Chr$(10) + "The last great march past. Newsman stands limp as a whimper as audience and eventare locked as one. Bing Crosby coos'You don't have to feel pain to sing the blues, you don't have to holla - you don't feel a thing in your dollar collar.' Martin Luther cries 'Everybody Sing!' and rings the grand old liberty bell. Leary, weary of his prison cell, walks on heaven, talks on hell."
  234.    DemoText = DemoText + Chr$(10) + "Who needs Medicare and the 35c flat rate fare, when Fred Astaire and Ginger Rogers are dancing through the air? From Broadway Melody stereotypes the band returns to 'Stars and Stripes' bringing a tear to the moonshiner, who's been pouring out his spirit from the illegal still. The pawn broker clears the noisy till and clutches his lucky dollar bill."
  235.    DemoText = DemoText + Chr$(10) + "Then the blackout." + Chr$(10) + Chr$(10) + "(Genesis, 'The Lamb lies down on Broadway')"
  236.    
  237.    y = VpeWriteBox(hDoc, 575, 200, 1625, -1, "[Center PenSize 3]This demo shows the capabilities and precision of VPE." + Chr$(10) + "Print this page and compare not only the positions of the frames," + Chr$(10) + "but the positions of each letter that can be seen." + Chr$(10) + "(Switch the grid on.)" + Chr$(10) + "This is true WYSIWYG !!!" + Chr$(10) + "('What you see is what you get')" + Chr$(10) + "Note, that the nearest result can be seen at a scaling of 1:1." + Chr$(10) + "With every other scaling you get 'best results' in comparison to execution speed.")
  238.    y = VpeWriteBox(hDoc, 100, y + 75, 2000, -1, "['Arial' FontSize 14 Left Bold Italic Underline PenSize 0]RIGHT ALIGNED, 0.25 cm blue frame, light-blue backgr., red bold text, Arial 9pt")
  239.    Call VpeStoreSet(hDoc, HEADLINE)
  240.    
  241.    Call VpeSelectFont(hDoc, "Arial", 9)
  242.    Call VpeSetPen(hDoc, 25, PS_SOLID, COLOR_BLUE)
  243.    Call VpeSetTextColor(hDoc, COLOR_LTRED)
  244.    Call VpeSetFontAttr(hDoc, ALIGN_RIGHT, 1, 0, 0)
  245.    Call VpeSetTransparentMode(hDoc, 0)
  246.    Call VpeSetBkgColor(hDoc, COLOR_CYAN)
  247.    Rem y+30 because frame = 0.25cm --> frame drawn around center of coordinates
  248.    Rem we a